//
//  HomeViewController.m
//  TestYoho
//
//  Created by YiDarren on 17/1/19.
//  Copyright © 2017年 YiDarren. All rights reserved.
//

#import "HomeViewController.h"
#import "MBProgressHUD+JDragon.h"
#import "MBProgressHUD.h"
#import "ZYBannerView.h"
#import "YHBannerWebViewController.h"
#import "HomePageViewController.h"
#import "HYPageView.h"

#define SCREEN_WIDTH ([UIScreen mainScreen].bounds.size.width)

#define SCREEN_HEIGHT ([UIScreen mainScreen].bounds.size.height)

@interface HomeViewController ()

@property (strong, nonatomic) ZYBannerView *bannerView;

@end

@implementation HomeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"首页";

    
    HYPageView *pageView = [[HYPageView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT) withTitles:@[@"关注",@"热门",@"最新"] withViewControllers:@[@"FirstViewViewController",@"FirstViewViewController",@"FirstViewViewController"] withParameters:@[@"123",@"这是一片很寂寞的天"]];
    
    UIButton *leftButton = [UIButton buttonWithType:UIButtonTypeSystem];
    [leftButton setImage:[UIImage imageNamed:@"search_"] forState:UIControlStateNormal];
    leftButton.frame = CGRectMake(0, 0, 50, 40);
    [leftButton setTintColor:[UIColor blackColor]];
    leftButton.transform = CGAffineTransformMakeScale(.7, .7);
    [leftButton addTarget:self action:@selector(leftButtonAction) forControlEvents:UIControlEventTouchUpInside];
    pageView.leftButton = leftButton;
    
    
    UIButton *rightButton = [UIButton buttonWithType:UIButtonTypeSystem];
    [rightButton setImage:[UIImage imageNamed:@"more_"] forState:UIControlStateNormal];
    rightButton.frame = CGRectMake(0, 0, 50, 40);
    [rightButton setTintColor:[UIColor blackColor]];
    rightButton.transform = CGAffineTransformMakeScale(.5, .5);
    [rightButton addTarget:self action:@selector(rightButtonAction) forControlEvents:UIControlEventTouchUpInside];
    pageView.rightButton = rightButton;

    [self.view addSubview:pageView];
    
}

-(void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    
    [self.navigationController setNavigationBarHidden:NO animated:YES];
}

- (void)leftButtonAction {
    
    [MBProgressHUD showActivityMessageInView:@"搜索🔍" timer:1];
}

- (void)rightButtonAction {
    
    [MBProgressHUD showActivityMessageInView:@"消息✉️" timer:1];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];

}

@end
